package cn.meye11.crm.domain.entity;

import cn.meye11.crm.domain.model.ConsumptionRecords;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;
import tk.mybatis.mapper.annotation.KeySql;
import tk.mybatis.mapper.annotation.LogicDelete;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 消费记录表(ConsumptionRecords)类
 *
 * @author makejava
 * @since 2023-11-18 19:20:43
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = ConsumptionRecordsEntity.Table)
public class ConsumptionRecordsEntity implements Serializable {

    public static final String Table = "t_consumption_records";
    private static final long serialVersionUID = 702601053779869753L;
    
    public ConsumptionRecordsEntity(ConsumptionRecords model) {
        BeanUtils.copyProperties(model, this);
    }

    @Id
    @KeySql(useGeneratedKeys = true)
    @Column(insertable = false)
    private Long id;
    /* 会员ID */
    private Long memberId;
    /* 会员名称 */
    private String memberName;
    /* 操作人ID */
    private Long userId;
    /* 消费金额(充值) */
    private Double amount;
    /* 消费金额(赠送) */
    private Double giftAmount;
    /* 消费项目，逗号分隔 */
    private String items;
    /* 消费时间 */
    private LocalDateTime consumptionTime;
    /* 操作人姓名 */
    private String operators;
    /* 客户画像标签 */
    private String label;
    /* 是否删除 */
    @LogicDelete
    private Integer del;
    /* 最后修改时间 */
    private LocalDateTime last;
    /* 创建时间 */
    private LocalDateTime time;
    /* 创建人 */
    private String createdBy;
    /* 最后修改人 */
    private String modifiedBy;
    /* 版本 */
//    @Version
    private Integer version;
    /* 进店渠道 */
    private String fitEntryChannels;
}
